package selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.util.List;
import java.util.Set;


public class WebDriverWrapper implements WebDriver {
    private WebDriver driver;
    public WebDriverWrapper(WebDriver driver)
    {
        this.driver = driver;

    }
    @Override
    public WebElement findElement(By by)
    {
        WebDriverWait wait = new WebDriverWait(driver,10);
        wait.until(ExpectedConditions.visibilityOfElementLocated(by));
        return driver.findElement(by);

    }
    @Override
    public List<WebElement> findElements(By by)

    {
        WebDriverWait wait = new WebDriverWait(driver,10);
        wait.until(ExpectedConditions.visibilityOfElementLocated(by));
        return driver.findElements(by);
    }
    @Override
    public void get(String url)
    {
        driver.get(url);
    }
    @Override
    public String getCurrentUrl()
    {
        return driver.getCurrentUrl();
    }
    @Override
    public String getPageSource()
    {
        return driver.getPageSource();
    }
    @Override
    public String getTitle()
    {
        return driver.getTitle();
    }
    @Override
    public String  getWindowHandle()
    {
        return driver.getWindowHandle();
    }
    @Override
    public Set<String> getWindowHandles()
    {
        return driver.getWindowHandles();
    }
    @Override
    public Options manage()
    {
        return driver.manage();
    }
    @Override
    public Navigation navigate()
    {
        return driver.navigate();
    }
    @Override
    public void quit()
    {
        driver.quit();
    }
    @Override
    public TargetLocator switchTo()
    {
        return driver.switchTo();
    }
    @Override
    public void close()
    {
        driver.close();
    }


}
